﻿<?xml version="1.0" encoding="utf-8" ?>
<Feature id="BackupRestoreDeploy" name="Backup Restore and Deploy" >

	<Dependencies>
		<Dependency type="feature">SecurityFeature.xml</Dependency>
		<Dependency type="feature">BizObjTreeFeature.xml</Dependency>
	</Dependencies>

	<BusinessRules>
		<BusinessRule name="executeCompanyRestore" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.RestoreBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="executeCompanyBackup" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackUpBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="executeCompanyRestoreFromZip" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.RestoreBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="executeLastSetRestoreFromZip" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.RestoreBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		
	</BusinessRules>

	<BusinessRules>
		<BusinessRule name="getCompanyBackups" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackupManagementBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getCompanyBackupDetails" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackupManagementBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteCompanyBackup" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackupManagementBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="restoreCompanyBackup" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackupManagementBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="createCompanyBackup" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackupManagementBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getBackupRestoreDeploymentOtionDisplay" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackupManagementBizRules,ScsCore" />
			</Option>
		</BusinessRule>
	</BusinessRules>

	<BusinessRules>
		<BusinessRule name="doDataSync" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="uploadClientSyncBackup" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getSiteSyncDetail" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getSiteSyncs" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="updateSiteSync" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="deleteSiteSync" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getSyncModeOptions" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getSyncDirectionOptions" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getConflictModeOptions" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getLocalCompaniesForDataSync" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
		<BusinessRule name="getRemoteSiteCompaniesForDataSync" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.DataSyncBizRules,ScsCore" />
			</Option>
		</BusinessRule>
	</BusinessRules>

	<BusinessRules> <!-- outdated, but left arround until further investigation-->
		<BusinessRule name="createTemplateDataBackup" security="disabled">
			<Option value="$BackupRestoreDeployRemoteTier$">
				<RemoteRule url="$BackupRestoreDeployRemoteTier$" />
				<LocalClass name="BackupRestoreDeploy.BackUpBizRules,ScsCore" />
			</Option>
		</BusinessRule>
	</BusinessRules>

	<BusinessObjects>
		<BusinessObject type="Feature" key="id">
			<Field name="id" type="Guid">
				<NULL/>
			</Field>
			<Field name="name" type="String"/>
			<Field name="xmlFile" type="String"/>
		</BusinessObject>

		<BusinessObject type="CompanyBackup" key="id">
			<Field name="id" type="String" />
			<Field name="dateCreated" type="Date" />			
			<Field name="filePath" type="String" />
			<Field name="zipName" type="String" />
			<Field name="comments" type="String" />
			
			<Field name="fullCompanyBackup" type="Boolean" />
			<Field name="includeChildren" type="Boolean" />
			<Field name="includeSitePages" type="Boolean" />
			
			<Field name="backupSince" type="Date"><NULL/></Field>
			<Field name="origionalBackupCompanies" type="List(Company)" />
			<Field name="backupCompanies" type="List(Company)" />
			<Field name="restoreCompanies" type="List(Company)" />
			<Field name="restoreAdditionalUsers" type="List(User)" />
			
			<Field name="filesInBackup" type="Integer" />
			<Field name="restoreConflictOption" type="String" />
		</BusinessObject>
		
		<BusinessObject type="AppDeployment">
			<Field name="company" type="CompanyBackup" />
			<Field name="fullCompanyBackup" type="Boolean" />
			<Field name="catalogs" type="String" />
			<Field name="directories" type="String" />
			<Field name="startUpFile" type="String" />
			<Field name="includeBaseFeature" type="Boolean" />
			<Field name="includeCatalogs" type="Boolean" />
			<Field name="overrideRootPage" type="Boolean" />
			<Field name="includeBin" type="Boolean" />
			<Field name="includeDar" type="Boolean" />
			<Field name="includeStartUpConfig" type="Boolean" />
			<Field name="features" type="List(Feature)" />			
		</BusinessObject>

		<BusinessObject type="SiteSync" key="id">
			<Field name="id" type="Guid"><NULL/></Field>
			<Field name="companyId" type="Guid" />
			
			<Field name="name" type="String" />
			<Field name="serverUrl" type="String" />
			<Field name="remoteCompanyId" type="Guid" />
			<Field name="localCompanyId" type="Guid" />
			<Field name="direction" type="String" /> 
			<Field name="syncMode" type="String" /> <!--Valid options: every [int] [mins|hours|days] -->
			<Field name="conflictMode" type="String" /><!--Valid options: overwrite, deny, tryMerge -->

			<Field name="lastGoodSync" type="Date"><NULL/></Field>
			<Field name="dataOptions" type="CompanyBackup" />
		</BusinessObject>

		<BusinessObject type="SyncModeOption" key="name">
			<Field name="name" type="String" />
			<Field name="value" type="String"><NULL/></Field>
			<Method name="calcVal" language="jscript.NET"><![CDATA[
				var n=self.getItem("value");
				return (n!=null)?n:self.getItem("name");
			]]></Method>
		</BusinessObject>
	</BusinessObjects>

	<ApplicationData>
		<Entry name="BackupRestoreDeploy" type="Swaf.Container.FlexiMap" />
		<Entry name="BackupRestoreDeploy.SyncModeOptions" type="IBizObjList.SyncModeOption">
			<SyncModeOptions>
				<SyncModeOption name="Manual" />
				<SyncModeOption name="Every 1 minute" />
				<SyncModeOption name="Every 5 minutes" />
				<SyncModeOption name="Every 1 hour" />
				<SyncModeOption name="Every 4 hours" />
				<SyncModeOption name="Every 1 day" />
			</SyncModeOptions>
		</Entry>
		<Entry name="BackupRestoreDeploy.ConflictModeOptions" type="IBizObjList.SyncModeOption">
			<SyncModeOptions>
				<SyncModeOption name="Overwrite Server" value="Overwrite" />
				<SyncModeOption name="Deny the Update" value="Deny" />
				<SyncModeOption name="Try to Merge" value="TryMerge" />
			</SyncModeOptions>
		</Entry>
		<Entry name="BackupRestoreDeploy.DirectionOptions" type="IBizObjList.SyncModeOption">
			<SyncModeOptions>
				<SyncModeOption name="Both" />
				<SyncModeOption name="Upload Only" value="Upload" />
				<SyncModeOption name="Download Only" value="Download" />
			</SyncModeOptions>
		</Entry>
	</ApplicationData>


	<ApplicationFunctions id="CompanyBackupRestore" description="Perform Company backup/restore">
		<AppFunction id="ManageCompanyBackupRestore" description="Perform Company backups and restores." />
	</ApplicationFunctions>
	
	<ClassFactory id="BizProcs">
		<Class type="BackupRestoreDeploy.Gui.CompanyBackupBizProc,ScsCore" name="companyBackupRestore"/>
		<Class type="BackupRestoreDeploy.Gui.BackupCompaniesBizProc,ScsCore" name="backupCompanies"/>
		<Class type="BackupRestoreDeploy.Gui.RestoreCompaniesBizProc,ScsCore" name="restoreCompanies"/>
		<Class type="BackupRestoreDeploy.Gui.SiteSyncSetupBizProc,ScsCore" name="siteSync"/>
	</ClassFactory>	
</Feature>